package class_wuziqi;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Image;
import java.net.URL;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

public class Left_Panel extends JPanel{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JButton botton_regret;//悔棋
	private JButton botton_draw;//和棋
	private JButton botton_start;//开始
	private JButton botton_defeat;//认输
	private JButton botton_replay;//游戏回放
	private Image bgimg;
	
	public Left_Panel(){	
		setLayout(new BorderLayout());
		JPanel panel1=new JPanel();//
		panel1.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 20));
		JLabel jl1=new JLabel();
		jl1.setIcon(new ImageIcon(getClass().getResource("/pic/left.jpeg")));
		jl1.setHorizontalTextPosition(SwingConstants.CENTER);
		jl1.setVerticalTextPosition(SwingConstants.BOTTOM);
		panel1.add(jl1);
		panel1.setPreferredSize(new Dimension(105,100));
		JLabel jl2=new JLabel(new ImageIcon(getClass().getResource("/pic/whiteChess.png")));
		panel1.add(jl2);
		panel1.setOpaque(false);
		add(panel1, BorderLayout.WEST);
		JPanel panel2=new JPanel();//
		panel2.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 20));
		JLabel jl3=new JLabel();
		jl3.setIcon(new ImageIcon(getClass().getResource("/pic/right.jpeg")));
		jl3.setHorizontalAlignment(SwingConstants.CENTER);
		jl3.setVerticalTextPosition(SwingConstants.BOTTOM);
		panel2.add(jl3);
		JLabel jl4=new JLabel(new ImageIcon(getClass().getResource("/pic/blackChess.png")));
		panel2.add(jl4);
		panel2.setPreferredSize(new Dimension(105, 100));
		panel2.setOpaque(false);
		add(panel2, BorderLayout.EAST);
		JLabel banner=new JLabel(new ImageIcon(getClass().getResource("/pic/banner.png")));//
		add(banner, BorderLayout.NORTH);
		JPanel bottonjp=new JPanel();
		bottonjp.setOpaque(false);
		bottonjp.setLayout(new FlowLayout());
		add(bottonjp, BorderLayout.SOUTH);
		botton_regret =new JButton("悔棋");
		botton_regret.setEnabled(false);
		bottonjp.add(botton_regret);
		botton_draw=new JButton("和棋");
		botton_draw.setEnabled(false);
		bottonjp.add(botton_draw);
		botton_start=new JButton("开始");
		bottonjp.add(botton_start);
		botton_defeat=new JButton("认输");
		botton_defeat.setEnabled(false);
		bottonjp.add(botton_defeat);
		botton_replay=new JButton("游戏回放");
		bottonjp.add(botton_replay);
		URL url=getClass().getResource("/pic/bg/13.jpeg");
		bgimg=new ImageIcon(url).getImage();
		ChessBoard cb=new ChessBoard();
		add(cb, BorderLayout.CENTER);
	}
	@Override
	protected void paintComponent(Graphics g) {
		g.drawImage(bgimg, 0, 0, getWidth(), getHeight(), null);
	}
}
